VERSION 5.00
Begin VB.Form frmSystray 
   Caption         =   "Systray"
   ClientHeight    =   930
   ClientLeft      =   165
   ClientTop       =   735
   ClientWidth     =   2235
   Icon            =   "frmSystray.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   930
   ScaleWidth      =   2235
   StartUpPosition =   3  'Windows Default
   Begin VB.PictureBox Picture1 
      Height          =   615
      Left            =   1440
      ScaleHeight     =   555
      ScaleWidth      =   675
      TabIndex        =   0
      Top             =   120
      Width           =   735
   End
   Begin VB.Menu MnuLista 
      Caption         =   "Lista"
      Begin VB.Menu mnuRipristina 
         Caption         =   "&Principale"
      End
      Begin VB.Menu mnuInscerisci 
         Caption         =   "&Inserisci"
      End
      Begin VB.Menu mnuOpzioni 
         Caption         =   "&Opzioni"
      End
      Begin VB.Menu mnuAbout 
         Caption         =   "&About"
      End
      Begin VB.Menu mnuEsci 
         Caption         =   "&Esci"
      End
   End
End
Attribute VB_Name = "frmSystray"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim t As NOTIFYICONDATA
Dim TIPS As String
Private Sub Form_Load()
    On Error Resume Next
    Dim I As Integer
    
    Call Linguaggio
    
    t.cbSize = Len(t)
    t.hwnd = Picture1.hwnd
    t.uId = 1&
    t.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
    t.ucallbackMessage = WM_MOUSEMOVE
    t.hIcon = Me.Icon
    t.szTip = TIPS & Chr$(0)
    Shell_NotifyIcon NIM_ADD, t
    Me.Hide
    For I = Forms.Count - 1 To 0 Step -1
        If Forms(I).Caption <> Me.Caption Then
            Forms(I).Hide
        End If
    Next I
    Exit Sub
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    On Error Resume Next
    t.cbSize = Len(t)
    t.hwnd = Picture1.hwnd
    t.uId = 1&
    Shell_NotifyIcon NIM_DELETE, t
End Sub
Private Sub mnuAbout_Click()
    On Error Resume Next
    frmAbout.Show vbModal, Me
End Sub
Private Sub mnuEsci_Click()
    On Error Resume Next
    Dim I As Integer
    While Forms.Count > 1
        I = 0
        While Forms(I).Caption = Me.Caption
            I = I + 1
        Wend
        Unload Forms(I)
    Wend
    Unload Me
End Sub
Private Sub mnuInscerisci_Click()
    On Error Resume Next
    frmInsert.Show vbModal, Me
End Sub
Private Sub mnuOpzioni_Click()
    On Error Resume Next
    frmOptions.Show vbModal, Me
End Sub
Private Sub mnuRipristina_Click()
    On Error Resume Next
    frmMain.Show
    frmMain.SetFocus
    Unload Me
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    On Error Resume Next
    Static rec As Boolean, msg As Long
    msg = X / Screen.TwipsPerPixelX
    If rec = False Then
        rec = True
        Select Case msg
            Case WM_RBUTTONUP:
                Me.PopupMenu MnuLista
        End Select
        rec = False
    End If
End Sub

'carica la lingua
Private Sub Linguaggio()
    On Error Resume Next
    TIPS = "CDOrganizer Systray"
    Me.MnuLista.Caption = "Lista"
    Me.mnuAbout.Caption = "&About"
    Me.mnuEsci.Caption = "&Esci"
    Me.mnuInscerisci.Caption = "&Inserisci"
    Me.mnuOpzioni.Caption = "&Opzioni"
    Me.mnuRipristina.Caption = "&Principale"
End Sub
